package org.springframework.learn.beans.note.fullConfig;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.learn.beans.service.OrderService;
import org.springframework.learn.beans.service.UserService;

/**
 * Description
 * Copyright © 启明星辰 版权所有
 *
 * @author chenjiquan
 * @date 2024-08-02
 */
@Configuration(proxyBeanMethods = true)
//@Configuration(proxyBeanMethods = false)
public class FullConfig {

	@Bean
	public UserService userService() {
		// 当@Configuration(proxyBeanMethods = false)时orderService不会经过代理逻辑，会拿到不同的对象
		// 当@Configuration(proxyBeanMethods = true)，orderService会经过代理逻辑，拿到一样的对象，因为本质上就是getBean去spring容器中拿出来的
		System.out.println(orderService());
//		System.out.println(orderService());
		return new UserService();
	}

	@Bean
	public OrderService orderService() {
		return new OrderService();
	}
}
